package mh.entity.object;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import mh.entity.IContainer;
import mh.map.Texture;

public class EntityFurnitureContainer extends EntityFurniture implements IContainer {

	private ArrayList<EntityObject>	inside;
	private int						maxCapacity;

	public EntityFurnitureContainer(Texture tex, int texOffsetX, int texOffsetY, int damageThreshold, int maximumHealth, int weight, EnumEntityObjectSize h, double reflection, int capacity) {
		super(tex, texOffsetX, texOffsetY, damageThreshold, maximumHealth, weight, h, reflection); //an object when created can always move. Furniture can't be collected
		this.maxCapacity = capacity;
		this.inside = new ArrayList<EntityObject>();
	}

	@Override
	public boolean isEmpty() {
		return this.inside.isEmpty();
	}

	@Override
	public boolean isFull() {
		return this.inside.size() == this.maxCapacity;
	}

	@Override
	public void putIn(EntityObject obj) {
		if (!this.isFull()) {
			this.inside.add(obj);
		}
	}

	@Override
	public void removeFrom(EntityObject obj) {
		if (this.inside.contains(obj)) {
			this.inside.remove(obj);
		}
	}

	@Override
	public List<EntityObject> getAll() {
		return Collections.unmodifiableList(this.inside);
	}

}
